<template>
  <div>
    <table id="table1">
      <tr>
        <td>编号</td>
        <td>省份</td>
        <td>市区</td>
        <td>区县</td>
        <td>详细地址</td>
        <td>用户</td>
      </tr>
      <tr v-for="index in list">
        <td v-for="value in index">{{value}}</td>
<!--        <td> <button @click="del(index.id)">删除</button>/-->
<!--          <button @click="update(index)">修改</button></td>-->
      </tr>
    </table>
    <div>
      <form>
        省份: <input v-model="fsite.province"/><br>
        市区：<input v-model="fsite.city"><br>
       区县：<input v-model="fsite.district"><br>
        详细地址：<input v-model="fsite.address"><br>
        用户：<input v-model="fsite.fUser"><br>
        <button type="submit" @click="add()">提交</button>
      </form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'FSiteManager',
  data(){
    return{
      fsite:{province:"",city:"",district:"",address:"",fUser:""},
      list: []
    }
  },
  components:{
    "table1":{
      template:"table1",
      props:{
        list:[],
        title:""
      }
    }
  },
  created () {
    this.$http.post('/fSite/select').then(data=>{
      this.list=data;
    })
  },
  methods:{
    add(){
      //alert("11");
      // var f = new FormData()
      // f.append('name',this.texture.name)
      this.$http.post("/fSite/insert", this.fsite).then(add=>{
        alert(add);
        if(add>0){
          alert("添加成功");
          window.location.reload();
        }else{
          alert("添加失败")
        }
      })
    },
  }
}
</script>

<style scoped>

</style>
